﻿using LogikBug.ModularMvc.Factories;

namespace LogikBug.ModularMvc
{
	public class MenuFactoryProvider
	{
		#region Fields

		private static readonly IMenuFactory DefaultMenuFactoryImpl;
		private static IMenuFactory _currentMenuFactory;

		#endregion

		#region Constructors

		static MenuFactoryProvider()
		{
			DefaultMenuFactoryImpl = new UlMenuFactory();
		}

		#endregion

		#region Properties

		public static IMenuFactory DefaultMenuFactory
		{
			get
			{
				return DefaultMenuFactoryImpl;
			}
		}

		public static IMenuFactory Current
		{
			get
			{
				return GetCurrentMenuFactory();
			}
		}

		#endregion

		#region Methods

		public static void SetCurrentMenuFactory(IMenuFactory menuFactory)
		{
			_currentMenuFactory = menuFactory;
		}

		public static IMenuFactory GetCurrentMenuFactory()
		{
			return _currentMenuFactory ?? DefaultMenuFactoryImpl;
		}

		#endregion
	}
}
